package com.lancoo.ccas52.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.lancoo.ccas52.entity.*;
import com.lancoo.ccas52.pojo.common.PageInfo;
import com.lancoo.ccas52.pojo.vo.*;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.ServletOutputStream;
import java.util.List;

public interface BasicRuleService {

    /**
     * 跨校区设置列表
     *
     * @param taskId
     * @param currentPage
     * @param pageSize
     * @param collegeId
     * @param majorId
     * @param gradeId
     * @param keyword
     * @return
     */
    CampusCrossGetResponse getMajor(Integer taskId, String collegeId, String majorId, String gradeId, String keyword, String campusId, Integer currentPage, Integer pageSize);

    /**
     * 批量修改校区
     *
     * @param majorIds
     * @param campusId
     * @param campusName
     * @return
     */
    boolean setCampus(List<Long> majorIds, String campusId, String campusName);

    /**
     * 获取院系上课场地范围
     * @param taskId
     * @param keyword
     * @return
     */
    List<CollegeRoomVo> getCollegeRoom(Integer taskId,String collegeId, String keyword);

    /**
     * 批量设置院系上课场地范围
     * @param collegeRoomInput
     * @return
     */
    Boolean setCollegeRoom(CollegeRoomInput collegeRoomInput);

    /**
     * 获取课时
     *
     * @param schoolId
     * @param term
     * @return
     */
    List<PeriodSchemeGroupVo> getPeriodSchemes(String schoolId, String term);

    /**
     * 根据学校id 学期id获取课时方案设置
     *
     * @param schoolId
     * @param term
     * @return
     */
    List<RuleWeekDay> getWeekDays(String schoolId, String term);

    /**
     * 更新课时方案设置，暂时同一个学校同一个学期只有第一个任务时可以设置
     *
     * @param taskId
     * @param weekDays
     */
    Boolean updateWeekDay(Integer taskId, List<RuleWeekDay> weekDays);

    /**
     * 根据学校id 学期id获取课时设置最大课时
     *
     * @param schoolId
     * @param term
     * @return
     */
    MaxPeriodScheme getMaxPeriodScheme(String schoolId, String term);

    /**
     * 初始化课时方案设置
     *
     * @param taskId
     * @param weekSet
     */
    void initWeekDays(Integer taskId, Integer weekSet, String schoolId, String term, List<PeriodScheme> periodSchemes);


    /**
     * 初始化基础规则
     *
     * @param taskId
     */
    void initRuleUsable(Integer taskId,String schoolId,String term);

    /**
     * @param setBasciRuleRequest Basic rules javabean
     */
    void setBasicRule(SetBasciRuleRequest setBasciRuleRequest);

    /**
     * 获取基础规则
     *
     * @param taskId
     * @param collegeId null获取全局设置 不为null获取院系设置
     * @return
     */
    List<RuleUsable> getCurrent(Integer taskId,String schoolId,String term,String collegeId);

    /**
     * 根据学校id 学期id获取日期禁排
     *
     * @param schoolId
     * @param term
     * @return
     */
    List<RuleTimeProhibit> getTimeProhibit(String schoolId, String term, String collegeId);

    /**
     * 设置日期禁排 相当于禁排所有周次的某一节课
     *
     * @param ruleTimeProhibits
     * @return
     */
    boolean setTimeProhibit(Integer taskId, String collegeId, List<RuleTimeProhibit> ruleTimeProhibits);

    /**
     * 获取教室禁排
     *
     * @param schoolId
     * @param term
     * @param roomId
     * @return
     */
    List<RuleRoomProhibit> getRoomProhibit(String schoolId, String term,String collegeId, Long roomId);

    /**
     * 设置教室禁排
     *
     * @param ruleRoomProhibits
     * @return
     */
    boolean setRoomProhibit(Integer taskId,String collegeId,List<RuleRoomProhibit> ruleRoomProhibits,List<Long> roomIds);

    /**
     * 删除教室禁排
     *
     * @param ids
     * @return
     */
    boolean removeRoomProhibitByIds(Integer taskId,String collegeId, List<Long> ids);

    /**
     * 获取教学班禁排列表
     *
     * @param taskId
     * @param page
     * @param collegeId
     * @param keyWord
     * @return
     */
    PageInfo<RuleTeachingClassVo> getTeachingClassProhibit(Integer taskId, IPage page, String courseTypeId, Integer courseNature, Integer majorProp, String collegeId, String keyWord, Integer state);

    /**
     * 设置教学班禁排
     *
     * @param ruleCourseProhibits
     * @return
     */
    boolean setTeachingClassProhibit(List<RuleCourseProhibit> ruleCourseProhibits,List<Long> teachingClassIds);

    /**
     * 删除教学班禁排
     *
     * @param ids
     * @return
     */
    boolean removeTeachingClassProhibitByIds(List<Long> ids);

    /**
     * 获取教师禁排列表
     *
     * @param page
     * @param taskId
     * @param collegeId
     * @param keyWord
     * @return
     */
    PageInfo<Teacher> getTeacherList(Page page, Integer taskId, String schoolId, String term, String collegeId, String keyWord, Integer state);

    /**
     * 设置教师禁排
     *
     * @param ruleTeacherTimes
     * @return
     */
    boolean setTeacherTimeProhibit(Integer taskId,String collegeId,Long teacherId, List<RuleTeacherTime> ruleTeacherTimes);

    /**
     * 删除教师禁排
     *
     * @param ids
     * @return
     */
    boolean removeTeacherTimeProhibitByIds(Integer taskId,String collegeId, List<Long> ids);

    /**
     * 获取教师统一设置
     * @param taskId
     * @return
     */
    RuleTeacherSetting getTeacherSetting(Integer taskId,String collegeId);

    /**
     * 设置教师统一设置
     * @param ruleTeacherSetting
     * @return
     */
    Boolean setTeacherSetting(RuleTeacherSetting ruleTeacherSetting);


    /**
     * 删除所有规则
     *
     * @param taskIds
     */
    void removeAllRule(List<Integer> taskIds);

    /**
     * 导入禁排
     *
     * @param importProhibit
     * @param file
     * @return
     */
    boolean excelToProhibit(ImportProhibit importProhibit, MultipartFile file);

    /**
     * 将课程禁排转化为教学班禁排excel
     * @param importProhibit
     * @param file
     * @param out
     */
    void conversionCourseProhibit(ImportProhibit importProhibit, MultipartFile file, ServletOutputStream out);


}
